<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Building_name extends CI_Controller {

	 function __construct()
    {
        parent::__construct();
        $this->load->model('building_name_model');
    }


    public function index()
	{
		$html=$this->init("大樓名稱","jquery","form,font-awesome");

        
        $html["building_name"] = $this->building_name_model->get_all();

		$this->load->view('base_data/building_name',$html);

	}

	public function add()
	{		        
     	$data  = array(	"value"=>$_POST["value"] , 
     					"explanation" =>$_POST["explanation"], 
     					"sequence" => $_POST["sequence"], );
     	$this->building_name_model->add($data);
     	redirect('/building_name');
		

	}

	public function del($id)
	{		        
     	$data  = array(	"id"=>$id );
     	$this->building_name_model->del($data);
     	redirect('/building_name');		
	}


	public function edit($id)
	{		        
     	$data  = array(	"id"=>$id );
     	$building_name=$this->building_name_model->get_info($data);
     	print_r($building_name);
     		
	}

	public function building_name_josn(){
		$this->load->model('building_name_model');
		$query=trim($this->input->get('query'));
		$building_name=$this->building_name_model->get_demand_building_name($query);
		echo urldecode(json_encode($building_name));
	}

	public function building_name_not_in_josn(){
		$this->load->model('building_name_model');
		$query=trim($this->input->get('query'));
		$building_name=$this->building_name_model->get_not_in($query);
		echo urldecode(json_encode($building_name));
	}
}

/* End of file welcome.php */
/* Location: ./application/controllers/welcome.php */